// $Id: bloomfilterquadstate.h 54 2004-10-11 15:31:22Z jonas $
#ifndef BLOOMFILTERQUADSTATE_H
#define BLOOMFILTERQUADSTATE_H

#include "bloomfilter.h"

// TODO: Fine tune these parameters!
const int BloomFilterQuadStateCount = 10000;

/**
 * This implmentation of the bloom filter has the ability to set its "bits" in
 * a more statistical manner. Instead of just two values (0 and 1) it can store
 * 4 values for each "bit"/chunk.
 */
class BloomFilterQuadState : public BloomFilter {
public:
	BloomFilterQuadState();
	BloomFilterQuadState(const BloomFilterQuadState &);
	virtual ~BloomFilterQuadState();

	BloomFilter *newCopy();
	unsigned int calcDistance(unsigned int);
	void update(unsigned int, std::map<File *, StoredFile *> &);
	void rebuild(std::map<File *, StoredFile *> &);

private:
	unsigned char getQuad(int);
	void setQuad(int, unsigned char);
	int getIndex(int);

	unsigned char *bits;
};

#endif
